UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y909RhhdVj01MW+48ekCgtRsUVJ2M/Z/B6Xi8z6nGMU=' 
WHERE 
  key_id = '286ef71d60f77e5f7498eb4badcaf6e37cb05e6451cc5567613a851a4aa99f91' 
  AND (
    token = 'Y909RhhdVj01MW+48ekCgtRsUVJ2M/Z/B6Xi8z6nGMU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032