UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Lb+sQG0IEP2N9mq7Jsu7M3v7yUSmJATLdrVjhRZzgz4=' 
WHERE 
  key_id = 'c3d53bed02973f9fb0a896661df330df1de29606f8709c180c4a4edcec4bf822' 
  AND (
    token = 'Lb+sQG0IEP2N9mq7Jsu7M3v7yUSmJATLdrVjhRZzgz4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017