UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f5InLyL0RH5FXTak4TMlbBRbbDFKr4XHKGi2olNdRx0=' 
WHERE 
  key_id = '9749dc236a4726e4284fb606de29d4ad326ced6e71e976f52cf8599f39ed97d2' 
  AND (
    token = 'f5InLyL0RH5FXTak4TMlbBRbbDFKr4XHKGi2olNdRx0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050