UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '36xyry98ihMzpcBNYvcKTHp5BuZGXaemc/IG3LcQPIE=' 
WHERE 
  key_id = 'c2e9ba05c784daee2100720f8b0f46f2186ba3d21e20dd8309d78f98849e980e' 
  AND (
    token = '36xyry98ihMzpcBNYvcKTHp5BuZGXaemc/IG3LcQPIE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037