UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eotd12PzocQ310x0IBzt31Tdr3bNpxoAnk9tg+w7HiQ=' 
WHERE 
  key_id = 'cace87ee10def888f963af9769c14af1f14104f2f1a1164ecc8b2f19d5f764c4' 
  AND (
    token = 'eotd12PzocQ310x0IBzt31Tdr3bNpxoAnk9tg+w7HiQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031