UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qrlfTytiXP9Vkwk2EJMHDZbHqEq8uner+9Oh5qwa5xg=' 
WHERE 
  key_id = '09b839de5d0887905f59b04254932c1894946efb5c74185e744d64ea62161309' 
  AND (
    token = 'qrlfTytiXP9Vkwk2EJMHDZbHqEq8uner+9Oh5qwa5xg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034