UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zXNDxpAwE/R36HDxnrim4mbIilLtjFf+KBiCh1eDx2U=' 
WHERE 
  key_id = '17182160a373ef66fd27feb6a294dc902911bf3b78441a24f855b623a5baced7' 
  AND (
    token = 'zXNDxpAwE/R36HDxnrim4mbIilLtjFf+KBiCh1eDx2U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028