UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0sBBewqqxr2PmBFN10sDnQV9uW2ZoMOmn0c3xnSoc2A=' 
WHERE 
  key_id = 'f561f8c4c01ef668194bf1e16075fe453f23434827b755c9d3e783cc88c676e5' 
  AND (
    token = '0sBBewqqxr2PmBFN10sDnQV9uW2ZoMOmn0c3xnSoc2A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040