UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r5EvBihTeU4oPaHsLYSKwdBzUULtXXO0TXHna+JNfQg=' 
WHERE 
  key_id = '8c1112914053868c79f13eea8f7e91cdae357cddc607f10b57c6af032c9db9a6' 
  AND (
    token = 'r5EvBihTeU4oPaHsLYSKwdBzUULtXXO0TXHna+JNfQg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00073