UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MMmVA1xquY3sqCz2BwQbWqdlCvChwzSLKa7xkUMH3E4=' 
WHERE 
  key_id = '39b0538d853cbace88bb8520b769da2e39ff869cf5c97e23e3398d2ca6cff2b7' 
  AND (
    token = 'MMmVA1xquY3sqCz2BwQbWqdlCvChwzSLKa7xkUMH3E4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028