UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C2egEDTTD8Ku7/zcNyiB5K3S1IlPuuEwnKYKOA4evT8=' 
WHERE 
  key_id = '0bb31bc5217c0bf16bef8826b5b7d675d3fd3431a6e2bb7bfc525a6c2da3693e' 
  AND (
    token = 'C2egEDTTD8Ku7/zcNyiB5K3S1IlPuuEwnKYKOA4evT8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040