UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KcEJJO0byYYCguiw+2kCUJl3so+Bpu1cpzo3s4Yiwt0=' 
WHERE 
  key_id = 'f07e24456540e4a5d4b0fb768f31a569af34461e0f91d55a754ddb10c8aa6df7' 
  AND (
    token = 'KcEJJO0byYYCguiw+2kCUJl3so+Bpu1cpzo3s4Yiwt0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037