UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wyj8SxlYfyTdkV+N1eFoq5utm5u8irmU8G0+4GualMs=' 
WHERE 
  key_id = '0bb4b100305b90a622e9e69054760ce9bb30b16afae5137753cfaec68d653800' 
  AND (
    token = 'Wyj8SxlYfyTdkV+N1eFoq5utm5u8irmU8G0+4GualMs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030