UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O38edY9RnckmZo6uxL+QJTCpd3r5C3MMxDgun57IrAY=' 
WHERE 
  key_id = '1b0595f1fab13b6b484ee4c2b59af296b782b2b37de5139dfdb2c425c65da0fe' 
  AND (
    token = 'O38edY9RnckmZo6uxL+QJTCpd3r5C3MMxDgun57IrAY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031