UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2NBWrxZrBbmxByTXZyCdU1CTr+clikLwn8pmm4sLDak=' 
WHERE 
  key_id = 'dbeea5f1162487c9728958c68d194c9e947d46959e2ba8d064e5d16dbae61448' 
  AND (
    token = '2NBWrxZrBbmxByTXZyCdU1CTr+clikLwn8pmm4sLDak=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044