UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GyqikPVqyssC5VMz+ks9Isy8RuxSbqU+O7VxIvgI9cQ=' 
WHERE 
  key_id = 'de3eef65386b7f5a2a33a4db10d6a9a1a19cf5f9326f6255f0754d7931389e7e' 
  AND (
    token = 'GyqikPVqyssC5VMz+ks9Isy8RuxSbqU+O7VxIvgI9cQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048