UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CXyNU5qbbTO1IA45+n/e7PAJoFhiHEWB7Xhcr08xtjA=' 
WHERE 
  key_id = '989727cce2ec75053f6a8804add9b6ab65154c3e465302081639558e3ecb64fd' 
  AND (
    token = 'CXyNU5qbbTO1IA45+n/e7PAJoFhiHEWB7Xhcr08xtjA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057