UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'npi+Ff8vlfDC3V+FNRWAMBp2/GQx3/Qw+p+x0SnLkxg=' 
WHERE 
  key_id = '3addf4e543e9c96f890b57a92d34f841af1d0083e531b035b78ea77a3710947a' 
  AND (
    token = 'npi+Ff8vlfDC3V+FNRWAMBp2/GQx3/Qw+p+x0SnLkxg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035