UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6XPBqtVvmobi818vKNNVbAoHMQ3k+RajXAwG7zmMDCY=' 
WHERE 
  key_id = 'fba21b6124c9e23c607daf558cbb54324528f72e4cd347f51eb341a9d2587163' 
  AND (
    token = '6XPBqtVvmobi818vKNNVbAoHMQ3k+RajXAwG7zmMDCY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034