UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V4F6c3utfTZGXusw8KeAUct3bHa97r7oqahFlEfBUuE=' 
WHERE 
  key_id = 'c6d8d52657f064b7a9243b01f09fb0b7fc63339f467e7272213d88834f474d9d' 
  AND (
    token = 'V4F6c3utfTZGXusw8KeAUct3bHa97r7oqahFlEfBUuE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031