UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oU8kD4GRZup2fX9MK8AkMKdL+Elj8JRmZsyyq7ZeDEw=' 
WHERE 
  key_id = '047d65dca3045fb5fbc764944dcdf39f8b30830dd4300cc5fffc98d98b06744e' 
  AND (
    token = 'oU8kD4GRZup2fX9MK8AkMKdL+Elj8JRmZsyyq7ZeDEw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018