UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Sk+1vG4TzVxP/YnPC3V8Z5yc528PwXU2TODiO+rla/w=' 
WHERE 
  key_id = '4f1200122862994e980177a9eeff803d3fd1d3baa9e39fff28a18d81e95d859a' 
  AND (
    token = 'Sk+1vG4TzVxP/YnPC3V8Z5yc528PwXU2TODiO+rla/w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037