UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K9vODoIn2zRiwMUDXKTABQ7Y2u8fT84xfCyQ2a0f2Pk=' 
WHERE 
  key_id = '7ad86a664da323773b40436d32305ea8f2381d762fdb076ef242e64b5e59ed5e' 
  AND (
    token = 'K9vODoIn2zRiwMUDXKTABQ7Y2u8fT84xfCyQ2a0f2Pk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00060