UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ag12bNP+42Kb6yAgLV2GpFw6Mh5OntQ5I96GTLpNd6U=' 
WHERE 
  key_id = '402486742db5b8400ab156f5e3ff6533611c7b9779621389892d4cd44460f403' 
  AND (
    token = 'ag12bNP+42Kb6yAgLV2GpFw6Mh5OntQ5I96GTLpNd6U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029