UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9juAfoCCDa2lAN8tZopa2rb5TJ4rpX4nfXFYim6BAoE=' 
WHERE 
  key_id = '02aa7bc878c2fcf123dd934a1496082d202663f46c184f313530460e2844fe1f' 
  AND (
    token = '9juAfoCCDa2lAN8tZopa2rb5TJ4rpX4nfXFYim6BAoE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039