UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1tMP4pj7ECJ4X7z+D0C5na52lxce+HuIPmVX91vEMgw=' 
WHERE 
  key_id = 'b2b0a4dbd65b313bd72465746f88d7bccd6da549763d1c54d95604b8653adc46' 
  AND (
    token = '1tMP4pj7ECJ4X7z+D0C5na52lxce+HuIPmVX91vEMgw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027