UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CVpaqdGivq/JRwO8z+jl4Bux6ai7gN2UwfQA6mU+wm4=' 
WHERE 
  key_id = '9f55327e2285a3a29be088f28483fe6fdcbaa777829c5ad747f1bffaf562904e' 
  AND (
    token = 'CVpaqdGivq/JRwO8z+jl4Bux6ai7gN2UwfQA6mU+wm4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034