UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/ffAomWFySHoSZhL/UT+wW8hKN9v7E0t+JU4ylh/xbg=' 
WHERE 
  key_id = '2de3de15e7992d164411420e929c42a06cfc2706e08749b746b988f7fa3bea9a' 
  AND (
    token = '/ffAomWFySHoSZhL/UT+wW8hKN9v7E0t+JU4ylh/xbg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038