UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i0D20iQiI8GvoLAOy0om7rRxtzZn141d08T9zspztaQ=' 
WHERE 
  key_id = '093dd012655fe80b3cb5e91a95b4dda565116843dcc9a78df2ab2d1a98cd1d31' 
  AND (
    token = 'i0D20iQiI8GvoLAOy0om7rRxtzZn141d08T9zspztaQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028