UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lFEbkfFluZJaBSy+eb0lL5pSePQZoV4YhizljXximuo=' 
WHERE 
  key_id = 'cf4900677b2b3939233c13357d187e42f621bdb4774e46006ff301d98a633879' 
  AND (
    token = 'lFEbkfFluZJaBSy+eb0lL5pSePQZoV4YhizljXximuo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047