UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f1R+0efW+8HpaEujMiGgZjdyFx/YiX/T52i8GTJWohA=' 
WHERE 
  key_id = 'ccdb3afc3f0ab469dbee62759275c60ea64934221632242f8d724a6a8cdda4bd' 
  AND (
    token = 'f1R+0efW+8HpaEujMiGgZjdyFx/YiX/T52i8GTJWohA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027